package com.example.demo.mapper;

import com.example.demo.entity.Instorage;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface InstorageMapper {

    @Insert("insert into instorage(Iid, Itime, carnum, Itonnum, Icasenum, Isbelong) values (#{Iid}, #{Itime}, #{carnum}, #{Itonnum}, #{Icasenum}, #{Isbelong})")
    int createInstorage(Instorage instorage);

    @Delete("delete from instorage where Iid = #{Iid}")
    int deleteInstorage(Integer Iid);

    @Select("select * from instorage where Iid = #{Iid}")
    Instorage findInstorage(Integer Iid);

    @Select("select * from instorage")
    List<Instorage> findAllinstorages();

    @Select("select * from instorage where Isbelong = #{Sid} order by (Iid+0)")
    List<Instorage> findAllinStoreByStorageid(Integer Sid);

    @Select("select Irtonnum from instorage where Iid=#{Iid}")
    double findRealTon(Integer Iid);

    @Update("update instorage set Irtonnum =  #{ton} where Iid = #{Iid}")
    int updateRealTon(Integer Iid,double ton);
}
